
import {createRouter, createWebHashHistory} from "vue-router";
import {
    aboutRoute,
    backgroundRoute,
    backupRoute, helpRoute,
    homeRoute,
    settingRoute,
    syncOneDriveRoute,
    syncRoute
} from "@/router/routePath";

const routes = [
    {
        path: backgroundRoute,
        name: 'Background',
        component: () => import("@/views/background/Background.vue"),
        meta: {
            title: '书签管理器 - 首页'
        },
        redirect: homeRoute,
        children:[
            {
                path: homeRoute,
                name: 'Home',
                component: () => import("@/views/home/Home.vue"),
                meta: {
                    title: '书签管理器 - 首页'
                },
            },
            {
                path: settingRoute,
                name: 'Setting',
                component: () => import("@/views/setting/Setting.vue"),
                meta: {
                    title: '书签管理器 - 基础设置'
                },
            },
            {
                path: backupRoute,
                name: 'Backup',
                component: () => import("@/views/backup/Backup.vue"),
                meta: {
                    title: '书签管理器 - 备份设置'
                },
            },
            {
                path: syncRoute,
                name: 'Sync',
                component: () => import("@/views/sync/Sync.vue"),
                meta: {
                    title: '书签管理器 - 同步设置'
                },
                children: [
                    {
                        path: syncOneDriveRoute,
                        name: 'Onedrive',
                        component: ()=> import("@/views/sync/servicePage/OneDrive.vue"),
                        meta: {
                            title: '书签管理器 - 同步设置 - OneDrive'
                        },
                    }
                ]
            },
            {
                path: helpRoute,
                name: 'Help',
                component: () => import("@/views/help/Help.vue"),
                meta: {
                    title: '书签管理器 - 帮助'
                },
            },
            {
                path: aboutRoute,
                name: 'About',
                component: () => import("@/views/about/About.vue"),
                meta: {
                    title: '书签管理器 - 关于'
                },
            },
        ],
    },
    {
        path: '/popup',
        name: 'Popup',
        component: () => import("@/views/popup/Popup.vue"),
        meta: {
            title: '书签管理器 - 弹出式界面'
        },
    },
    {
        path: '/oauth',
        name: 'Oauth',
        component: () => import("@/views/popup/Popup.vue"),
        meta: {
            title: '书签管理器 - 弹出式界面'
        },
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router;
